package com.ft.oa.web.bidproject;

import com.ft.oa.domain.dto.ApiResult;
import com.ft.oa.domain.project.CompanyQualification;
import com.ft.oa.domain.project.CompanyQualificationPage;
import com.ft.oa.service.project.CompanyQualificationService;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

/**
 * 公司资质维护接口路
 * @author liyansheng
 * @ClassName CompanyQualificationController
 * @date 2022-1-5 15:49:09
 */
@RestController
@RequestMapping("/qualified")
public class CompanyQualificationController {

    @Resource
    private CompanyQualificationService companyQualificationService;

    /**
     * 新增招投标项目
     * @param qualification
     * @return
     */
    @PostMapping("/add")
    public ApiResult addBipProject(@RequestBody CompanyQualification qualification){
        ApiResult result = companyQualificationService.add(qualification);
        return result;
    }

    /**
     * 根据主键查询招投标项目
     * @param id
     * @return
     */
    @PostMapping("/select/{id}/{tabType}")
    public ApiResult selectById(@PathVariable Long id,@PathVariable String tabType){
        ApiResult result = companyQualificationService.selectById(id,tabType);
        return result;
    }

    /**
     * 编辑招投标项目
     * @param qualification
     * @return
     */
    @PostMapping("/edit")
    public ApiResult editBipProject(@RequestBody CompanyQualification qualification){
        ApiResult result = companyQualificationService.edit(qualification);
        return result;
    }

    /**
     * 删除招投标项目
     * @param id
     * @return
     */
    @PostMapping("/del/{id}")
    public ApiResult delBipProject(@PathVariable Long id){
        ApiResult result = companyQualificationService.del(id);
        return result;
    }


    /**
     * 招投标分页查询
     * @return
     */
    @PostMapping("/page")
    public ApiResult page(@RequestBody CompanyQualificationPage qualificationPage){
        //qualificationPage.setBidResult(-1);
        ApiResult result = companyQualificationService.page(qualificationPage);
        return result;
    }

    /**
     * 上传附件
     * @param files
     * @return
     */
    @GetMapping("/upload")
    public ApiResult upload(@RequestParam("files") MultipartFile files[]) {
        ApiResult result = companyQualificationService.upload(files,"招投标项目管理");
        return result;
    }




}
